package org.colour.amber;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableAsync;

@MapperScan("org.colour.amber.dao")
@ServletComponentScan(basePackages = "org.colour.amber.filter")
@EnableAsync
@EnableCaching
@SpringBootApplication
public class AmberApplication {

    public static void main(String[] args) {
        SpringApplication.run(AmberApplication.class, args);
    }

    @Bean
    public OpenAPI openAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("Amber 接口文档")
                        .description("描述")
                        .version("20240911")
                        .license(new License().name("Apache 2.0").url("http://springdoc.org")))
                .externalDocs(new ExternalDocumentation()
                        .description("SpringShop Wiki Document")
                        .url("https://springshop.wiki.github.org/docs"))
                .addServersItem(new Server().description("本地环境").url("http://localhost:8080"));
    }
}
